/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package clip.net;


import L.L;
import clip.clipApp;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author admin
 */
public class FileHttpServer {
    HttpServer httpServer;
    clipApp app;
    public FileHttpServer(clipApp app) throws IOException {
        L.d("initialisiere httpserver");
        this.app=app;
        //TESTING wieder umändern
        httpServer = HttpServer.create(new InetSocketAddress(13134),5);
        httpServer.createContext("/", new HttpHandler(app));
        httpServer.setExecutor(null); // creates a default executor
    }

    public void stop() {
        httpServer.stop(10);
    }

    public void start() {
        L.d("starting");
        httpServer.start();
    }
    
    public static void main(String[] args) {
        try {
            new FileHttpServer(null).start();
        } catch (IOException ex) {
            Logger.getLogger(FileHttpServer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    
}
